<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                template="/pages/templates/internal.xhtml"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:p="http://primefaces.org/ui">
    <ui:define name="head">
        <title>Nuevo Equipo</title>
    </ui:define>
    <ui:define name="body">
        <f:event type="preRenderView" listener="#{newTeamController.init()}"/>
        <h:form id="formNewTeam">
            <p:messages autoUpdate="true"/>
            <p:panelGrid id="panel" columns="2">
                <f:facet name="header">Nuevo Equipo</f:facet>
                <p:outputLabel for="txtNombre" value="Nombre:" />
                <p:inputText id="txtNombre" value="#{newTeamController.team.nombre}" required="true"/>
                <p:outputLabel for="checkSeeded" value="Cabeza de serie:" />
                <p:selectBooleanCheckbox id="checkSeeded" value="#{newTeamController.team.cabezaSerie}" required="true"/>
                <p:outputLabel for="selectGroup" value="Grupo:" />
                <p:selectOneMenu id="selectGroup" value="#{newTeamController.team.grupoId.id}">
                    <f:selectItems value="#{newTeamController.groups}" var="group"
                                   itemLabel="#{group.nombre}" itemValue="#{group.id}"/>
                </p:selectOneMenu>
            </p:panelGrid>
            <p:commandButton value="Guardar" action="#{newTeamController.save()}"
                         process="@form" update="formNewTeam"/>
            <p:commandButton value="Cancelar" immediate="true" ajax="false"
                             action="#{facesContext.externalContext.redirect('/worldCupInformation/pages/team/teamAdmin.xhtml')}"/>
        </h:form>
    </ui:define>
</ui:composition>